// JavaScript Document
function updateRadio (val) 
{
	if(teamMembers.driverSelect[val].checked == true && 
	   teamMembers.captainSelect[val].disabled == true ) 
	{
		teamMembers.captainSelect[val].disabled=false;
	}
	else if(teamMembers.driverSelect[val].checked == false)
	{
		teamMembers.captainSelect[val].disabled=true;
		teamMembers.captainSelect[val].checked=false;
	}
}

function validateParams (minDrivers, maxDrivers) 
{
	captain = -1;
	for (i = 0; i < teamMembers.captainSelect.length && captain == -1; i++)
	{
		if(teamMembers.captainSelect[i].checked)
			captain = i;
	}
	if(captain == -1)
	{
		window.alert("You must select a captain.");
		return false;
	}
	
	count = 0;
	for (i = 0; i < teamMembers.driverSelect.length; i++)
	{
		if(teamMembers.driverSelect[i].checked)
			count++;
	}
	if(count < minDrivers)
	{
		var message = "<?php echo $test; ?>";
		window.alert( message.replace(/{minDrivers}/g, minDrivers));
		return false;
	}
	if(count > maxDrivers)
	{
		window.alert("You must select at most " + maxDrivers + " drivers.");
		return false;
	}
}